fix(claim): do not report accept when decision persist fails - #33
fix(claim): do not report accept when decision persist fails#33SebTardif wants to merge 1 commit into
Conversation
Accept waited for the clawtributors role PUT, then recorded the decision with a log-only catch. A database failure still DMed the claimant, announced the grant, and replied Claim accepted while the stored claim stayed pending. Await recordClaimDecision on the success path. On persist failure, reply with an error and skip the DM, announcement, and accepted reply. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed September 1, 2026, 5:06 PM ET / 21:06 UTC. ClawSweeper reviewWhat this changesThe PR makes the Discord claim-review Accept button show a recovery message and stop success-side effects when saving an accepted claim decision throws, with focused regression coverage. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 3 items remain Keep open: the branch correctly prevents success notifications after a failed claim-decision write, and current main still has the log-only failure path. The supplied proof and added test replace the actual decision writer, so real persistence-failure recovery remains unproven before merge. Priority: P2 Review scores
Verification
How this fits togetherHermit’s Discord claim-review flow grants the clawtributors role, records the accepted decision in persistent storage, then notifies the claimant and updates the review message. This change adds a failure branch between persistence and those downstream notifications. flowchart TD
A[Reviewer clicks Accept] --> B[Grant Discord role]
B --> C[Save accepted claim decision]
C -->|Saved| D[Notify claimant and update review]
C -->|Write fails| E[Show moderator recovery message]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land this narrow ordering fix after redacted proof from a real claim-review path or approved production-path harness shows both an actual write failure and successful completion. Do we have a high-confidence way to reproduce the issue? Yes—current main still logs a rejected decision write and continues to the success side-effects; forcing that writer to reject is a high-confidence focused path, although this read-only review did not execute it. Is this the best way to solve the issue? Yes—the branch’s persistence gate is the narrowest maintainable way to prevent a failed stored decision from being reported as accepted; the remaining gap is production-path proof rather than solution design. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 38f929b69cba. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (13 earlier review cycles; latest 8 shown)
|
What Problem This Solves
Fixes an issue where a reviewer pressing Accept on a clawtributor claim would be told the claim was accepted even when saving the decision to the database failed. Discord could add the clawtributors role, then the bot still DMed the claimant, posted the announcement, and replied "Claim accepted" while the stored claim stayed pending.
That false success is worse than a failed Accept: staff think the review is finished, the claimant is told they are a clawtributor, and a later
/claimstill looks pending.Why This Change Was Made
Accept now waits for
recordClaimDecisionto finish. If the write fails, the review button replies with an error and does not DM, announce, or mark the review message accepted. The previous success copy is sent only after the decision is saved. Reject is unchanged.User Impact
Reviewers get an accurate private reply when Accept cannot save the decision. A database failure no longer looks like a completed clawtributor grant. Claimants are not told they were accepted while the claim record is still pending.
Evidence
Live
bunrun of/tmp/proof-hermit-F004.tsagainst upstreamsrc/server/claimServer.tsand this branch. The script calls the production Accept button (claimReviewComponents[0].run) after Discord's role PUT returns 204. One run makesrecordClaimDecisionthrowdatabase unavailable. The other run lets the write finish.Before this patch a failed decision write still printed Claim accepted, sent the DM, announced the grant, and patched the review message. After the patch a failed write prints Could not record claim and skips those success side effects. A successful write still prints Claim accepted.
Related: the swallow landed in #10 (
2b970350, 2026-05-12). Same false-success class as #26 (automod-bypass role changes) and #27 (inactivity-warn addMember).Real behavior proof
Behavior or issue addressed: Review-channel Accept reported Claim accepted, DMed the claimant, and announced the clawtributors grant even when saving the accepted decision failed, so the stored claim stayed pending.
Real environment tested: macOS 26.6.1 Darwin 25.6.0 arm64, Node v26.7.0, bun 1.3.14, patched checkout
/tmp/oc-pr-hermit-F004onfix/f004-claim-persist-error(base72b5de1).Exact steps or command run after this patch:
Evidence after fix: terminal output from the patched Accept handler:
Observed result after fix: A failed decision write now replies Could not record claim and does not DM, announce, or patch the review message. A successful write still replies Claim accepted and still DMs, announces, and patches.
What was not tested: A live Discord review-channel click against production D1. Discord role PUT was stubbed to 204 so the persist path is the only failure.
Summary
Accept no longer treats a swallowed
recordClaimDecisionerror as a completed grant. Persist is awaited on the success path. Persist failure replies with an error.